<script>
	import {
		mapMutations
	} from 'vuex';
	export default {
		methods: {
			...mapMutations(['login'])
		},
		onLaunch: function() {
			console.log('App Launch')
			// #ifdef APP-PLUS
			plus.screen.lockOrientation('portrait-primary'); //锁定屏幕
			const dom = weex.requireModule('dom');
			dom.addRule('fontFace', { 
				'fontFamily': "graceIconfont",
				'src': "url('/static/grace.ttf')"
			});
			// #endif
			let token = uni.getStorageSync('token') || '';
			console.log(token)
			console.log('token app')
			if (!token) {
				this.$u.to('/pages/login/login', 'reLaunch')
			}else{
				this.$store.commit('setToken', token)
				// this.$store.dispatch('setToken', token)
				this.$u.to('/pages/index/index','reLaunch')
			}
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/* 加载框架核心样式 */
	@import "./GraceUI5/css/graceUI.css";
	/* 加载主题样式 */
	@import "./GraceUI5/skin/black.css";
    @import "./static/common.css";
	 @import "./static/commonPage.css";
	/* 加载图标字体 - 条件编译模式 */
	/* #ifdef APP-PLUS-NVUE */
	.gui-icons {
		font-family: graceIconfont;
	}

	/* #endif */
</style>